/**
 * 
 */
package edu.fiu.cis.selfhealingdisk;




/**
 * @author vanvorst
 * 
 */
public class NoParity extends ParityModel {
	
	/**
	 * @param totalParityGroups
	 * @param parityGroupSize
	 * @return
	 */
	public static int calcExtraBlocksPerGroup(long totalParityGroups,
			long parityGroupSize) {
		return 0;
	}

	/**
	 * @param originalTrace
	 * @param originalLayout
	 */
	public NoParity(IOTrace originalTrace,
			DiskLayout originalLayout) {
		super(originalTrace, originalLayout);
	}
	
	

	/* (non-Javadoc)
	 * @see edu.fiu.cis.selfhealingdisk.ParityModel#nextEvent(long)
	 */
	@Override
	public Event nextEvent(long currentTime) {
		//Get all trace events before the current time
		IORequestList l = new IORequestList();
		
		IORequest or = null;
		while ((or = this.originalTrace.peek()) != null) {
			if (or.getRequestTime() <= currentTime) {
				//Move the iterator
				this.originalTrace.next();
				//System.out.println(or);
				IORequest nr = new IORequest(or.getRequestTime(),or.getLba(), or.getSize(),or.getType(),false);
				this.transformedTrace.addIORequest(nr);
				l.add(nr);
				return Event.createIOEvent(l);
			} else {
				return Event.createWarpEvent(or.getRequestTime());
			}
		};
		
		
		return Event.createDoneEvent();
	}
	
	

}
